#!/bin/sh
#
##########################
#
# Input decoder tools and functions for Monkey's Audio
# Return: 0 is TRUE, >0 if ERROR
# STDOUT path to decoder if TRUE
#
##########################

PATH=${PATH}:/bin:/usr/bin:/usr/local/bin
export PATH=${PATH}

FILE=`realpath $0`              # lib/cue2tracks/codecs/input/ape
LIB_DIR=`dirname ${FILE}`       # lib/cue2tracks/codecs/input/ape
LIB_DIR=`dirname ${LIB_DIR}`    # lib/cue2tracks/codecs/input
LIB_DIR=`dirname ${LIB_DIR}`    # lib/cue2tracks/codecs
LIB_DIR=`dirname ${LIB_DIR}`    # lib/cue2tracks

NO_ERR=0
E_UNK=1
E_CODEC_TOOL_NOT_FOUND=2

# --== VARIABLES ==--

codec_TOOL="mac"
codec_PKG="mac"

exec_TOOL=`${LIB_DIR}/check_tool ${codec_TOOL} ${codec_PKG}`
if [ -z "${exec_TOOL}" ]; then
    exit ${E_CODEC_TOOL_NOT_FOUND}
fi
echo ${exec_TOOL}
exit ${NO_ERR}
